package com.nikitova.craps3d.model 
{
	import com.nikitova.craps3d.Main;

	import org.puremvc.as3.multicore.patterns.proxy.*;

	import flash.display.*;	

	/**
	 * @author schranz
	 */
	public class ScreenProxy extends Proxy 
	{
		public static const NAME 			: String = 'ScreenProxy';
		
		private static var _stage 			: Stage;
		
		private var _guiContainer:Sprite;
		private var _game3DContainer:Sprite;

		public function ScreenProxy(vo : Object = null)
		{
			super(ScreenProxy.NAME, vo);
		}

		override public function onRegister( ) : void 
		{
			_stage = data.stage;
			makeContainers();
		}
		
		//**PUBLIC METHODS**//
		public function addChild(_child : DisplayObject, _container : DisplayObjectContainer) : void
		{
			_container.addChild(_child);
		}

		public function removeChild(_child : DisplayObject, _container : DisplayObjectContainer) : void
		{
			if(_container.contains(_child))
			{
				_container.removeChild(_child);
			}
			else
			{
			}
		}
		
		//**GETTER/SETTER**//
		public function get stage() : Stage
		{
			return _stage;
		}

		public function get main() : Main
		{
			return data as Main;			
		}
		public function get guiContainer() : Sprite
		{
			return _guiContainer;
		}
		public function get game3DContainer() : Sprite
		{
			return _game3DContainer;
		}
		
		//**PRIVATE METHODS**//
		private function makeContainers() : void
		{
			_guiContainer = new Sprite();
			main.addChild(_guiContainer);
			
			_game3DContainer = new Sprite();
			main.addChild(_game3DContainer);
		}
	}
}
